package com.inossem.warehousestorage_inossem.utils;

import android.content.Context;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.TextView;

import com.google.gson.Gson;
import com.inossem.utils.base.ArithUtils;
import com.inossem.utils.base.RegexUtils;
import com.inossem.utils.base.Utils;
import com.inossem.warehousestorage_inossem.R;
import com.inossem.warehousestorage_inossem.adapter.OverviewAdapter;
import com.inossem.warehousestorage_inossem.bean.allocation.AllocationOutOverViewBean;
import com.inossem.warehousestorage_inossem.bean.common.GetOperatorBean;
import com.inossem.warehousestorage_inossem.bean.common.GetOperatorGroupBean;
import com.inossem.warehousestorage_inossem.bean.outStorage.BatchBean;
import com.inossem.warehousestorage_inossem.bean.outStorage.ItemListBean;
import com.inossem.warehousestorage_inossem.bean.outStorage.OutStorageAllocatingConfirmRequestBean;
import com.inossem.warehousestorage_inossem.bean.outStorage.OutStorageAllocatingOverviewBean;
import com.inossem.warehousestorage_inossem.bean.outStorage.OutStorageCalculatorBean;
import com.inossem.warehousestorage_inossem.bean.outStorage.OutStorageOtherBean;
import com.inossem.warehousestorage_inossem.bean.outStorage.OutStorageOtherConfirmRequestBean;
import com.inossem.warehousestorage_inossem.bean.outStorage.OutStorageOtherOverviewBean;
import com.inossem.warehousestorage_inossem.bean.outStorage.OutStoragePickingConfirmRequestBean;
import com.inossem.warehousestorage_inossem.bean.outStorage.OutStoragePickingOverviewBean;
import com.inossem.warehousestorage_inossem.bean.outStorage.OutStorageProductionConfirmRequestBean;
import com.inossem.warehousestorage_inossem.bean.outStorage.OutStorageProductionOverviewBean;
import com.inossem.warehousestorage_inossem.bean.outStorage.OutStorageReturnConfirmRequestBean;
import com.inossem.warehousestorage_inossem.bean.outStorage.OutStorageReturnOverviewBean;
import com.inossem.warehousestorage_inossem.bean.outStorage.OutStorageSaleConfirmRequestBean;
import com.inossem.warehousestorage_inossem.bean.outStorage.OutStorageSaleOverviewBean;
import com.inossem.warehousestorage_inossem.bean.outStorage.PositionListBean;
import com.inossem.warehousestorage_inossem.bean.outStorage.SNBean;
import com.inossem.warehousestorage_inossem.bean.outStorage.SNItemInfo;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by leij on 2017/7/25.
 */

public class OutStorageUtils {

    public static final String CONFIRM = "1";

    private static final String IS_FOCUS_TRUE = "1";  //允许修改过账日期

    private static final String IS_FOCUS_FALSE = "0";//不允许修改过账日期

    public static final String TYPE_BATCH = "1";//批次

    public static final String TYPE_SN = "2";//序列号

    public static final String TYPE_NONE = "3";//无

    public static final String OUT_STORAGE_TYPE_PICKING = "1";//领料出库

    public static final String OUT_STORAGE_TYPE_SALE = "2";//销售出库

    public static final String OUT_STORAGE_TYPE_PRODUCTION = "3";//生产领用

    public static final String OUT_STORAGE_TYPE_ALLOCATION = "10";//调拨出库

    public static final String SNTYPE_POSITION = "3";//仓位

    public static final String SNTYPE_PACKAGE = "1";//打包码

    public static final String SNTYPE_SN = "2";//序列号

    public static final int TAB_MATERIEL = 1;//查看待出库物料

    public static final int TAB_SALE_OUT_STORAGE = 2;//创建销售出库单

    public static final boolean FLAG_FLUSH = true;//刷新状态

    public static final boolean FLAG_ADD = false;//添加

    //获取生产领用出库信息
    public static OutStorageProductionOverviewBean getOutStorageProductionOverviewBean(Context context) {
        String json = SPUtils.getProductionOutStorageInformation(context);
        Gson gson = new Gson();
        return gson.fromJson(json, OutStorageProductionOverviewBean.class);
    }

    //保存生产领用信息
    public static void saveOutStorageProductionOverviewBean(Context context, OutStorageProductionOverviewBean bean) {
        Gson gson = new Gson();
        SPUtils.saveProductionOutStorageInformation(context, gson.toJson(bean, OutStorageProductionOverviewBean.class));
    }

    //获取领料出库信息
    public static OutStoragePickingOverviewBean getOutStoragePickingOverviewBean(Context context) {
        String json = SPUtils.getPickingOutStorageInformation(context);
        Gson gson = new Gson();
        return gson.fromJson(json, OutStoragePickingOverviewBean.class);
    }

    //保存领料出库信息
    public static void saveOutStoragePickingOverviewBean(Context context, OutStoragePickingOverviewBean bean) {
        Gson gson = new Gson();
        SPUtils.savePickingOutStorageInformation(context, gson.toJson(bean, OutStoragePickingOverviewBean.class));
    }

    //获取调拨出库信息
    public static OutStorageAllocatingOverviewBean getOutStorageAllocatingOverviewBean(Context context) {
        String json = SPUtils.getAllocatingOutStorageInformation(context);
        Gson gson = new Gson();
        return gson.fromJson(json, OutStorageAllocatingOverviewBean.class);
    }

    //获取调拨出库信息(新)
    public static AllocationOutOverViewBean getAllocationOutOverViewBean(Context context) {
        String json = SPUtils.getAllotionOutStorageInformation(context);
        Gson gson = new Gson();
        return gson.fromJson(json, AllocationOutOverViewBean.class);
    }

    //获取销售出库信息
    public static OutStorageSaleOverviewBean getOutStorageSaleOverviewBean(Context context) {
        String json = SPUtils.getSaleOutStorageInformation(context);
        Gson gson = new Gson();
        return gson.fromJson(json, OutStorageSaleOverviewBean.class);
    }

    //保存销售出库信息
    public static void saveOutStorageSaleOverviewBean(Context context, OutStorageSaleOverviewBean bean) {
        Gson gson = new Gson();
        SPUtils.saveSaleOutStorageInformation(context, gson.toJson(bean, OutStorageSaleOverviewBean.class));
    }

    //保存调拨出库出库信息
    public static void saveOutStorageAllocatingOverviewBean(Context context, OutStorageAllocatingOverviewBean bean) {
        Gson gson = new Gson();
        SPUtils.saveAllocatingOutStorageInformation(context, gson.toJson(bean, OutStorageAllocatingOverviewBean.class));
    }

    //获取领料退库信息
    public static OutStorageReturnOverviewBean getOutStorageReturnOverviewBean(Context context) {
        String json = SPUtils.getReturnOutStorageInformation(context);
        Gson gson = new Gson();
        return gson.fromJson(json, OutStorageReturnOverviewBean.class);
    }

    //保存领料退库信息
    public static void saveOutStorageReturnOverviewBean(Context context, OutStorageReturnOverviewBean bean) {
        Gson gson = new Gson();
        SPUtils.saveReturnOutStorageInformation(context, gson.toJson(bean, OutStorageReturnOverviewBean.class));
    }

    //通过序号获取领料出库详情
    public static ItemListBean getPickingOutStorageDetailBySerial(Context context, String serial) {
        List<ItemListBean> MaterielList = getOutStoragePickingOverviewBean(context).getBody().getItem_list();
        for (int i = 0; i < MaterielList.size(); i++) {
            ItemListBean bean = MaterielList.get(i);
            if (bean.getRefer_receipt_rid().equals(serial)) {
                return bean;
            }
        }
        return null;
    }

    //通过序号获取调拨出库详情
    public static ItemListBean getAllocationOutStorageDetailBySerial(Context context, String serial) {
        List<ItemListBean> MaterielList = getAllocationOutOverViewBean(context).getBody().getItem_list();
        for (int i = 0; i < MaterielList.size(); i++) {
            ItemListBean bean = MaterielList.get(i);
            if (bean.getRefer_receipt_rid().equals(serial)) {
                return bean;
            }
        }
        return null;
    }

    //通过序号获取调拨出库详情
    public static ItemListBean getAllocationOutStorageDetailByMatid(Context context, String mat_id) {
        List<ItemListBean> MaterielList = getAllocationOutOverViewBean(context).getBody().getItem_list();
        for (int i = 0; i < MaterielList.size(); i++) {
            ItemListBean bean = MaterielList.get(i);
            if (bean.getMat_id().equals(mat_id)) {
                return bean;
            }
        }
        return null;
    }

    //通过序号获取生产领用详情
    public static ItemListBean getProductionOutStorageDetailBySerial(Context context, String serial) {
        List<ItemListBean> MaterielList = getOutStorageProductionOverviewBean(context).getBody().getItem_list();
        for (int i = 0; i < MaterielList.size(); i++) {
            ItemListBean bean = MaterielList.get(i);
            if (bean.getRefer_receipt_rid().equals(serial)) {
                return bean;
            }
        }
        return null;
    }

    //通过序号获取调拨出库详情
    public static OutStorageAllocatingOverviewBean.BodyBean.ItemListBean getAllocatingOutStorageDetailBySerial(Context context, String serial) {
        List<OutStorageAllocatingOverviewBean.BodyBean.ItemListBean> MaterielList = getOutStorageAllocatingOverviewBean(context).getBody().getItem_list();
        for (int i = 0; i < MaterielList.size(); i++) {
            OutStorageAllocatingOverviewBean.BodyBean.ItemListBean bean = MaterielList.get(i);
            if (bean.getStock_output_rid().equals(serial)) {
                return bean;
            }
        }
        return null;
    }

    //通过序号获取销售出库详情
    public static ItemListBean getSaleOutStorageDetailBySerial(Context context, String serial) {
        List<ItemListBean> MaterielList = getOutStorageSaleOverviewBean(context).getBody().getItem_list();
        for (int i = 0; i < MaterielList.size(); i++) {
            ItemListBean bean = MaterielList.get(i);
            if (bean.getRefer_receipt_rid().equals(serial)) {
                return bean;
            }
        }
        return null;
    }

    //通过序号获取采购退货详情
    public static OutStorageReturnOverviewBean.BodyBean.ItemListBean getReturnOutStorageDetailBySerial(Context context, String serial) {
        List<OutStorageReturnOverviewBean.BodyBean.ItemListBean> MaterielList = getOutStorageReturnOverviewBean(context).getBody().getItem_list();
        for (int i = 0; i < MaterielList.size(); i++) {
            OutStorageReturnOverviewBean.BodyBean.ItemListBean bean = MaterielList.get(i);
            if (bean.getStock_output_rid().equals(serial)) {
                return bean;
            }
        }
        return null;
    }

    //更新领料出库详情
    public static void updatePickingOutStorageDetail(Context context, ItemListBean materielItem) {
        OutStoragePickingOverviewBean bean = getOutStoragePickingOverviewBean(context);
        List<ItemListBean> pickingOutStorageList = bean.getBody().getItem_list();
        for (int i = 0; i < pickingOutStorageList.size(); i++) {
            ItemListBean pickingOutStorageItem = pickingOutStorageList.get(i);
            if (materielItem.getRefer_receipt_rid().equals(pickingOutStorageItem.getRefer_receipt_rid())) {
                pickingOutStorageList.remove(pickingOutStorageItem);
                break;
            }
        }
        pickingOutStorageList.add(0, materielItem);
        bean.getBody().setItem_list(pickingOutStorageList);
        saveOutStoragePickingOverviewBean(context, bean);
    }

    //更新领料出库详情
    public static void updateProductionOutStorageDetail(Context context, ItemListBean materielItem) {
        OutStorageProductionOverviewBean bean = getOutStorageProductionOverviewBean(context);
        List<ItemListBean> productionOutStorageList = bean.getBody().getItem_list();
        for (int i = 0; i < productionOutStorageList.size(); i++) {
            ItemListBean pickingOutStorageItem = productionOutStorageList.get(i);
            if (materielItem.getRefer_receipt_rid().equals(pickingOutStorageItem.getRefer_receipt_rid())) {
                productionOutStorageList.remove(pickingOutStorageItem);
                break;
            }
        }
        productionOutStorageList.add(0, materielItem);
        bean.getBody().setItem_list(productionOutStorageList);
        saveOutStorageProductionOverviewBean(context, bean);
    }

    //更新调拨出库详情(新)
    public static void updateAllocatingOutStorageDetail(Context context, ItemListBean materielItem) {
        AllocationOutOverViewBean bean = getAllocationOutOverViewBean(context);
        List<ItemListBean> pickingOutStorageList = bean.getBody().getItem_list();
        for (int i = 0; i < pickingOutStorageList.size(); i++) {
            ItemListBean pickingOutStorageItem = pickingOutStorageList.get(i);
            if (materielItem.getMat_id().equals(pickingOutStorageItem.getMat_id())) {
                pickingOutStorageList.remove(pickingOutStorageItem);
                break;
            }
        }
        pickingOutStorageList.add(0, materielItem);
        bean.getBody().setItem_list(pickingOutStorageList);
        Gson gson = new Gson();
        String json = gson.toJson(bean, AllocationOutOverViewBean.class);
        SPUtils.saveAllocationOutStorageInformation(context, json);
    }

    //更新销售出库详情
    public static void updateSaleOutStorageDetail(Context context, ItemListBean materielItem) {
        OutStorageSaleOverviewBean bean = getOutStorageSaleOverviewBean(context);
        List<ItemListBean> saleOutStorageList = bean.getBody().getItem_list();
        for (int i = 0; i < saleOutStorageList.size(); i++) {
            ItemListBean saleOutStorageItem = saleOutStorageList.get(i);
            if (materielItem.getRefer_receipt_rid().equals(saleOutStorageItem.getRefer_receipt_rid())) {
                saleOutStorageList.remove(saleOutStorageItem);
                break;
            }
        }
        saleOutStorageList.add(0, materielItem);
        bean.getBody().setItem_list(saleOutStorageList);
        Gson gson = new Gson();
        String json = gson.toJson(bean, OutStorageSaleOverviewBean.class);
        SPUtils.saveSaleOutStorageInformation(context, json);
    }

    //更新采购退货详情
    public static void updateReturnOutStorageDetail(Context context, OutStorageReturnOverviewBean.BodyBean.ItemListBean materielItem) {
        OutStorageReturnOverviewBean bean = getOutStorageReturnOverviewBean(context);
        List<OutStorageReturnOverviewBean.BodyBean.ItemListBean> returnOutStorageList = bean.getBody().getItem_list();
        for (int i = 0; i < returnOutStorageList.size(); i++) {
            OutStorageReturnOverviewBean.BodyBean.ItemListBean saleOutStorageItem = returnOutStorageList.get(i);
            if (materielItem.getStock_output_rid().equals(saleOutStorageItem.getStock_output_rid())) {
                returnOutStorageList.remove(saleOutStorageItem);
                break;
            }
        }
        returnOutStorageList.add(0, materielItem);
        bean.getBody().setItem_list(returnOutStorageList);
        Gson gson = new Gson();
        String json = gson.toJson(bean, OutStorageReturnOverviewBean.class);
        SPUtils.saveReturnOutStorageInformation(context, json);
    }

    //过滤领料出库货品列表信息
    public static List<ItemListBean> getPickingOutStorageList(Context context, String materiel) {
        List<ItemListBean> pickingOutStorageList = new ArrayList<>();
        List<ItemListBean> allPickingOutStorageList = getOutStoragePickingOverviewBean(context).getBody().getItem_list();
        for (int i = 0; i < allPickingOutStorageList.size(); i++) {
            ItemListBean item = allPickingOutStorageList.get(i);
            if (item.getMat_id().contains(materiel) || item.getMat_name().contains(materiel)) {
                pickingOutStorageList.add(item);
                continue;
            }
        }
        return pickingOutStorageList;
    }

    //过滤生产领用货品列表信息
    public static List<ItemListBean> getProductionOutStorageList(Context context, String materiel) {
        List<ItemListBean> productionOutStorageList = new ArrayList<>();
        List<ItemListBean> allProductionOutStorageList = getOutStorageProductionOverviewBean(context).getBody().getItem_list();
        for (int i = 0; i < allProductionOutStorageList.size(); i++) {
            ItemListBean item = allProductionOutStorageList.get(i);
            if (item.getMat_id().contains(materiel) || item.getMat_name().contains(materiel)) {
                productionOutStorageList.add(item);
                continue;
            }
        }
        return productionOutStorageList;
    }

    //过滤调拨出库货品列表信息
    public static List<OutStorageAllocatingOverviewBean.BodyBean.ItemListBean> getAllocatingOutStorageList(Context context, String materiel) {
        List<OutStorageAllocatingOverviewBean.BodyBean.ItemListBean> pickingOutStorageList = new ArrayList<>();
        List<OutStorageAllocatingOverviewBean.BodyBean.ItemListBean> allPickingOutStorageList = getOutStorageAllocatingOverviewBean(context).getBody().getItem_list();
        for (int i = 0; i < allPickingOutStorageList.size(); i++) {
            OutStorageAllocatingOverviewBean.BodyBean.ItemListBean item = allPickingOutStorageList.get(i);
            if (item.getMat_code().contains(materiel) || item.getMat_name().contains(materiel)) {
                pickingOutStorageList.add(item);
                continue;
            }
        }
        return pickingOutStorageList;
    }

    //过滤销售出库货品列表信息
    public static List<ItemListBean> getSaleOutStorageList(Context context, String materiel) {
        List<ItemListBean> saleOutStorageList = new ArrayList<>();
        List<ItemListBean> allSaleOutStorageList = getOutStorageSaleOverviewBean(context).getBody().getItem_list();
        for (int i = 0; i < allSaleOutStorageList.size(); i++) {
            ItemListBean item = allSaleOutStorageList.get(i);
            if (item.getMat_code().contains(materiel) || item.getMat_name().contains(materiel)) {
                saleOutStorageList.add(item);
                continue;
            }
        }
        return saleOutStorageList;
    }

    //过滤采购退货货品列表信息
    public static List<OutStorageReturnOverviewBean.BodyBean.ItemListBean> getReturnOutStorageList(Context context, String materiel) {
        List<OutStorageReturnOverviewBean.BodyBean.ItemListBean> returnOutStorageList = new ArrayList<>();
        List<OutStorageReturnOverviewBean.BodyBean.ItemListBean> allReturnOutStorageList = getOutStorageReturnOverviewBean(context).getBody().getItem_list();
        for (int i = 0; i < allReturnOutStorageList.size(); i++) {
            OutStorageReturnOverviewBean.BodyBean.ItemListBean item = allReturnOutStorageList.get(i);
            if (item.getMat_code().contains(materiel) || item.getMat_name().contains(materiel)) {
                returnOutStorageList.add(item);
                continue;
            }
        }
        return returnOutStorageList;
    }

    //检查领料出库列表是否至少填写一项
    public static int getPickingOutStorageNumber(Context context) {
        int result = 0;
        List<ItemListBean> materielList = getOutStoragePickingOverviewBean(context).getBody().getItem_list();
        for (int i = 0; i < materielList.size(); i++) {
            ItemListBean materielItem = materielList.get(i);
            if (!TextUtils.isEmpty(materielItem.getActualSendNumber()) && Float.parseFloat(materielItem.getActualSendNumber()) > 0) {
                result = result + 1;
            }
        }
        return result;
    }

    //检查生产领用列表是否至少填写一项
    public static int getProductionOutStorageNumber(Context context) {
        int result = 0;
        List<ItemListBean> materielList = getOutStorageProductionOverviewBean(context).getBody().getItem_list();
        for (int i = 0; i < materielList.size(); i++) {
            ItemListBean materielItem = materielList.get(i);
            if (!TextUtils.isEmpty(materielItem.getActualSendNumber()) && Float.parseFloat(materielItem.getActualSendNumber()) > 0) {
                result = result + 1;
            }
        }
        return result;
    }

    //检查领调拨库列表是否至少填写一项
    public static int getAllocatingOutStorageNumber(Context context) {
        int result = 0;
        List<OutStorageAllocatingOverviewBean.BodyBean.ItemListBean> materielList = getOutStorageAllocatingOverviewBean(context).getBody().getItem_list();
        for (int i = 0; i < materielList.size(); i++) {
            OutStorageAllocatingOverviewBean.BodyBean.ItemListBean materielItem = materielList.get(i);
            if (!TextUtils.isEmpty(materielItem.getActualSendNumber()) && Float.parseFloat(materielItem.getActualSendNumber()) > 0) {
                result = result + 1;
            }
        }
        return result;
    }

    //检查销售出库列表是否至少填写一项
    public static int getSaleOutStorageNumber(Context context) {
        int result = 0;
        List<ItemListBean> materielList = getOutStorageSaleOverviewBean(context).getBody().getItem_list();
        for (int i = 0; i < materielList.size(); i++) {
            ItemListBean materielItem = materielList.get(i);
            if (!TextUtils.isEmpty(materielItem.getActualSendNumber()) && Float.parseFloat(materielItem.getActualSendNumber()) > 0) {
                result = result + 1;
            }
        }
        return result;
    }

    //检查领料退库列表是否至少填写一项
    public static int getReturnOutStorageNumber(Context context) {
        int result = 0;
        List<OutStorageReturnOverviewBean.BodyBean.ItemListBean> materielList = getOutStorageReturnOverviewBean(context).getBody().getItem_list();
        for (int i = 0; i < materielList.size(); i++) {
            OutStorageReturnOverviewBean.BodyBean.ItemListBean materielItem = materielList.get(i);
            if (!TextUtils.isEmpty(materielItem.getActualSendNumber()) && Float.parseFloat(materielItem.getActualSendNumber()) > 0) {
                result = result + 1;
            }
        }
        return result;
    }

    //删除领料出库验收人
//    public static void deletePickingOperator(Context context, String id) {
//        OutStoragePickingOverviewBean bean = getOutStoragePickingOverviewBean(context);
//        List<GetOperatorBean.OperatorBean> operatorList = bean.getBody().getUser_list();
//        for (int i = 0; i < operatorList.size(); i++) {
//            GetOperatorBean.OperatorBean operatorItem = operatorList.get(i);
//            if (operatorItem.getUser_id().equals(id)) {
//                operatorList.remove(operatorItem);
//                break;
//            }
//        }
//        bean.getBody().setUser_list(operatorList);
//        Gson gson = new Gson();
//        String json = gson.toJson(bean, OutStoragePickingOverviewBean.class);
//        SPUtils.savePickingOutStorageInformation(context, json);
//    }

    //删除调拨出库验收人
    public static void deleteAllocatingOperator(Context context, String id) {
        OutStorageAllocatingOverviewBean bean = getOutStorageAllocatingOverviewBean(context);
        List<GetOperatorBean.OperatorBean> operatorList = bean.getBody().getUser_list();
        for (int i = 0; i < operatorList.size(); i++) {
            GetOperatorBean.OperatorBean operatorItem = operatorList.get(i);
            if (operatorItem.getUser_id().equals(id)) {
                operatorList.remove(operatorItem);
                break;
            }
        }
        bean.getBody().setUser_list(operatorList);
        Gson gson = new Gson();
        String json = gson.toJson(bean, OutStorageAllocatingOverviewBean.class);
        SPUtils.saveAllocatingOutStorageInformation(context, json);
    }

    //删除销售出库验收人
//    public static void deleteSaleOperator(Context context, String id) {
//        OutStorageSaleOverviewBean bean = getOutStorageSaleOverviewBean(context);
//        List<GetOperatorBean.OperatorBean> operatorList = bean.getBody().getUser_list();
//        for (int i = 0; i < operatorList.size(); i++) {
//            GetOperatorBean.OperatorBean operatorItem = operatorList.get(i);
//            if (operatorItem.getUser_id().equals(id)) {
//                operatorList.remove(operatorItem);
//                break;
//            }
//        }
//        bean.getBody().setUser_list(operatorList);
//        Gson gson = new Gson();
//        String json = gson.toJson(bean, OutStorageSaleOverviewBean.class);
//        SPUtils.saveSaleOutStorageInformation(context, json);
//    }

    //删除采购退货验收人
    public static void deleteReturnOperator(Context context, String id) {
        OutStorageReturnOverviewBean bean = getOutStorageReturnOverviewBean(context);
        List<GetOperatorBean.OperatorBean> operatorList = bean.getBody().getUser_list();
        for (int i = 0; i < operatorList.size(); i++) {
            GetOperatorBean.OperatorBean operatorItem = operatorList.get(i);
            if (operatorItem.getUser_id().equals(id)) {
                operatorList.remove(operatorItem);
                break;
            }
        }
        bean.getBody().setUser_list(operatorList);
        Gson gson = new Gson();
        String json = gson.toJson(bean, OutStorageReturnOverviewBean.class);
        SPUtils.saveReturnOutStorageInformation(context, json);
    }

    //添加领料出库验收人
//    public static void addPickingOperator(Context context, GetOperatorBean.OperatorBean receiveItem) {
//        OutStoragePickingOverviewBean bean = getOutStoragePickingOverviewBean(context);
//        List<GetOperatorBean.OperatorBean> receiverList = bean.getBody().getUser_list() == null ? new ArrayList<>() : bean.getBody().getUser_list();
//        receiverList.add(0, receiveItem);
//        bean.getBody().setUser_list(receiverList);
//        Gson gson = new Gson();
//        String json = gson.toJson(bean, OutStoragePickingOverviewBean.class);
//        SPUtils.savePickingOutStorageInformation(context, json);
//    }

    //添加调拨出库验收人
    public static void addAllocatingOperator(Context context, GetOperatorBean.OperatorBean receiveItem) {
        OutStorageAllocatingOverviewBean bean = getOutStorageAllocatingOverviewBean(context);
        List<GetOperatorBean.OperatorBean> receiverList = bean.getBody().getUser_list() == null ? new ArrayList<>() : bean.getBody().getUser_list();
        receiverList.add(0, receiveItem);
        bean.getBody().setUser_list(receiverList);
        Gson gson = new Gson();
        String json = gson.toJson(bean, OutStorageAllocatingOverviewBean.class);
        SPUtils.saveAllocatingOutStorageInformation(context, json);
    }

//    //添加销售出库验收人
//    public static void addSaleOperator(Context context, GetOperatorBean.OperatorBean receiveItem) {
//        OutStorageSaleOverviewBean bean = getOutStorageSaleOverviewBean(context);
//        List<GetOperatorBean.OperatorBean> receiverList = bean.getBody().getUser_list() == null ? new ArrayList<>() : bean.getBody().getUser_list();
//        receiverList.add(0, receiveItem);
//        bean.getBody().setUser_list(receiverList);
//        Gson gson = new Gson();
//        String json = gson.toJson(bean, OutStorageSaleOverviewBean.class);
//        SPUtils.saveSaleOutStorageInformation(context, json);
//    }

    //添加采购退货验收人
    public static void addReturnOperator(Context context, GetOperatorBean.OperatorBean receiveItem) {
        OutStorageReturnOverviewBean bean = getOutStorageReturnOverviewBean(context);
        List<GetOperatorBean.OperatorBean> receiverList = bean.getBody().getUser_list() == null ? new ArrayList<>() : bean.getBody().getUser_list();
        receiverList.add(0, receiveItem);
        bean.getBody().setUser_list(receiverList);
        Gson gson = new Gson();
        String json = gson.toJson(bean, OutStorageReturnOverviewBean.class);
        SPUtils.saveReturnOutStorageInformation(context, json);
    }

    //是否有领料出库操作人员
//    public static boolean hasPickingOperator(Context context) {
//        List<GetOperatorBean.OperatorBean> operatorList = getOutStoragePickingOverviewBean(context).getBody().getUser_list();
//        if (operatorList != null && !operatorList.isEmpty()) {
//            return true;
//        }
//        return false;
//    }

    //是否有调拨出库操作人员
    public static boolean hasAllocatingOperator(Context context) {
        List<GetOperatorBean.OperatorBean> operatorList = getOutStorageAllocatingOverviewBean(context).getBody().getUser_list();
        if (operatorList != null && !operatorList.isEmpty()) {
            return true;
        }
        return false;
    }

//    //是否有销售出库操作人员
//    public static boolean hasSaleOperator(Context context) {
//        List<GetOperatorBean.OperatorBean> operatorList = getOutStorageSaleOverviewBean(context).getBody().getUser_list();
//        if (operatorList != null && !operatorList.isEmpty()) {
//            return true;
//        }
//        return false;
//    }

    //是否有采购退货操作人员
    public static boolean hasReturnOperator(Context context) {
        List<GetOperatorBean.OperatorBean> operatorList = getOutStorageReturnOverviewBean(context).getBody().getUser_list();
        if (operatorList != null && !operatorList.isEmpty()) {
            return true;
        }
        return false;
    }

    //拼生产领用对象
    public static OutStorageProductionConfirmRequestBean getOutStorageProductionConfirmRequestBean(Context context) {
        OutStorageProductionConfirmRequestBean result = new OutStorageProductionConfirmRequestBean();
        OutStorageProductionOverviewBean bean = getOutStorageProductionOverviewBean(context);
        if (!TextUtils.isEmpty(bean.getBody().getOutStorageNumber())) {
            result.setStock_output_id(bean.getBody().getOutStorageNumber());
        }
        result.setRefer_receipt_code(bean.getBody().getRefer_receipt_code());
        result.setApply_user_name(bean.getBody().getApply_user_name());
        result.setApply_depart_name(bean.getBody().getApply_depart_name());
        result.setApply_time(bean.getBody().getApply_time());
        List<ItemListBean> resultItemList = new ArrayList<>();
        List<ItemListBean> itemList = bean.getBody().getItem_list();
        for (int i = 0; i < itemList.size(); i++) {
            ItemListBean item = itemList.get(i);
            if (!TextUtils.isEmpty(item.getActualSendNumber())) {
                resultItemList.add(createItem(item, (i + 1) + ""));
            }
        }
        result.setItem_list(resultItemList);
        return result;
    }

    //拼领料出库对象
    public static OutStoragePickingConfirmRequestBean getOutStoragePickingConfirmRequestBean(Context context) {
        OutStoragePickingConfirmRequestBean result = new OutStoragePickingConfirmRequestBean();
        OutStoragePickingOverviewBean bean = getOutStoragePickingOverviewBean(context);
        if (!TextUtils.isEmpty(bean.getBody().getOutStorageNumber())) {
            result.setStock_output_id(bean.getBody().getOutStorageNumber());
        }
        result.setRefer_receipt_code(bean.getBody().getRefer_receipt_code());
        result.setApply_user_name(bean.getBody().getApply_user_name());
        result.setApply_depart_name(bean.getBody().getApply_depart_name());
        result.setApply_time(bean.getBody().getApply_time());
        List<ItemListBean> resultItemList = new ArrayList<>();
        List<ItemListBean> itemList = bean.getBody().getItem_list();
        for (int i = 0; i < itemList.size(); i++) {
            ItemListBean item = itemList.get(i);
            if (!TextUtils.isEmpty(item.getActualSendNumber())) {
                resultItemList.add(createItem(item, (i + 1) + ""));
            }
        }
        result.setItem_list(resultItemList);
        return result;
    }

    //拼调拨出库对象
    public static OutStorageAllocatingConfirmRequestBean getOutStoragePAllocatingConfirmRequestBean(Context context) {
        OutStorageAllocatingConfirmRequestBean result = new OutStorageAllocatingConfirmRequestBean();
        OutStorageAllocatingOverviewBean bean = getOutStorageAllocatingOverviewBean(context);
        if (!TextUtils.isEmpty(bean.getBody().getOutStorageNumber())) {
            result.setStock_output_id(bean.getBody().getOutStorageNumber());
        }
        result.setRefer_receipt_code(bean.getBody().getRefer_receipt_code());
        result.setPreorder_id(bean.getBody().getPreorder_id());
        //物料
        List<OutStorageAllocatingConfirmRequestBean.ItemListBean> resultItemList = new ArrayList<>();
        List<OutStorageAllocatingOverviewBean.BodyBean.ItemListBean> itemList = bean.getBody().getItem_list();
        for (int i = 0; i < itemList.size(); i++) {
            OutStorageAllocatingConfirmRequestBean.ItemListBean resultItem = new OutStorageAllocatingConfirmRequestBean.ItemListBean();
            OutStorageAllocatingOverviewBean.BodyBean.ItemListBean item = itemList.get(i);
            resultItem.setStock_output_rid((i + 1) + "");
            resultItem.setRefer_receipt_rid(item.getRefer_receipt_rid());
            resultItem.setMat_id(item.getMat_id());
            resultItem.setUnit_id(item.getUnit_id());
            resultItem.setDecimal_place(item.getDecimal_place());
            resultItem.setFty_id(item.getFty_id());
            resultItem.setLocation_id(item.getLocation_id());
            resultItem.setStock_qty(item.getStock_qty());
            resultItem.setSend_qty(item.getSend_qty());
            resultItem.setOutput_qty(item.getActualSendNumber());//实发数量
            List<OutStorageAllocatingConfirmRequestBean.ItemListBean.PositionListBean> resultPositionList = new ArrayList<>();
            List<BatchBean.BatchInfoBean> positionList = item.getBatchList();
            for (int j = 0; positionList != null && j < positionList.size(); j++) {
                OutStorageAllocatingConfirmRequestBean.ItemListBean.PositionListBean resultPositionItem = new OutStorageAllocatingConfirmRequestBean.ItemListBean.PositionListBean();
                BatchBean.BatchInfoBean positionItem = positionList.get(j);
                resultPositionItem.setStock_output_position_id((j + 1) + "");
                resultPositionItem.setStock_id(positionItem.getStock_id());
                resultPositionItem.setQty(positionItem.getQty());
                resultPositionList.add(resultPositionItem);
            }
            resultItem.setPosition_list(resultPositionList);
            if (!TextUtils.isEmpty(resultItem.getOutput_qty())) {
                resultItemList.add(resultItem);
            }
        }
        result.setItem_list(resultItemList);
        //经办人
        List<OutStorageAllocatingConfirmRequestBean.UserListBean> resultOperatorList = new ArrayList<>();
        List<GetOperatorBean.OperatorBean> operatorList = bean.getBody().getUser_list();
        for (int i = 0; i < operatorList.size(); i++) {
            OutStorageAllocatingConfirmRequestBean.UserListBean resultOperatorItem = new OutStorageAllocatingConfirmRequestBean.UserListBean();
            GetOperatorBean.OperatorBean OperatorItem = operatorList.get(i);
            resultOperatorItem.setUser_id(OperatorItem.getUser_id());
            resultOperatorItem.setRole_id(OperatorItem.getRole_id());
            resultOperatorList.add(resultOperatorItem);
        }
        result.setUser_list(resultOperatorList);
        return result;
    }

    //拼销售出库对象
    public static OutStorageSaleConfirmRequestBean getOutStorageSaleConfirmRequestBean(Context context) {
        OutStorageSaleConfirmRequestBean result = new OutStorageSaleConfirmRequestBean();
        OutStorageSaleOverviewBean bean = getOutStorageSaleOverviewBean(context);
        if (!TextUtils.isEmpty(bean.getBody().getOutStorageNumber())) {
            result.setStock_output_id(bean.getBody().getOutStorageNumber());
        }
        result.setRefer_receipt_code(bean.getBody().getRefer_receipt_code());
        result.setReceive_code(bean.getBody().getReceive_code());
        result.setReceive_name(bean.getBody().getReceive_name());
        result.setOrder_type(bean.getBody().getOrder_type());
        result.setOrder_type_name(bean.getBody().getOrder_type_name());
        List<ItemListBean> resultItemList = new ArrayList<>();
        List<ItemListBean> itemList = bean.getBody().getItem_list();
        for (int i = 0; i < itemList.size(); i++) {
            ItemListBean item = itemList.get(i);
            if (!TextUtils.isEmpty(item.getActualSendNumber())) {
                resultItemList.add(createItem(item, (i + 1) + ""));
            }
        }
        result.setItem_list(resultItemList);
        return result;
    }

    private static ItemListBean createItem(ItemListBean item, String stockOutputRid) {
        ItemListBean resultItem = new ItemListBean();
        resultItem.setStock_output_rid(stockOutputRid);
        resultItem.setRefer_receipt_rid(item.getRefer_receipt_rid());
        resultItem.setMat_id(item.getMat_id());
        resultItem.setUnit_id(item.getUnit_id());
        resultItem.setDecimal_place(item.getDecimal_place());
        resultItem.setFty_id(item.getFty_id());
        resultItem.setLocation_id(item.getLocation_id());
        resultItem.setOrder_qty(item.getOrder_qty());
        resultItem.setSend_qty(item.getSend_qty());
        resultItem.setOutput_qty(item.getActualSendNumber());//实发数量
        List<PositionListBean> positionList = new ArrayList<>();
        List<BatchBean.BatchInfoBean> itemBatchList = item.getBatchList();
        List<SNBean.SNInfoBean> itemSNList = item.getSnList();
        if (itemBatchList != null && !itemBatchList.isEmpty()) {
            for (int j = 0; j < itemBatchList.size(); j++) {
                PositionListBean positionItem = new PositionListBean();
                BatchBean.BatchInfoBean itemBatchInfo = itemBatchList.get(j);
                positionItem.setStock_output_position_id((j + 1) + "");
                positionItem.setStock_id(itemBatchInfo.getStock_id());
                positionItem.setQty(itemBatchInfo.getQty());
                positionItem.setSn_list(new ArrayList<>());
                positionList.add(positionItem);
            }
        }
        int tempNumber = (positionList == null || positionList.isEmpty()) ? 1 : positionList.size();
        if (itemSNList != null && !itemSNList.isEmpty()) {
            for (int j = 0; j < itemSNList.size(); j++) {
                PositionListBean positionItem = new PositionListBean();
                SNBean.SNInfoBean itemSNInfo = itemSNList.get(j);
                positionItem.setStock_output_position_id(tempNumber + j + "");
                positionItem.setStock_id(itemSNInfo.getStock_id());
                positionItem.setSn_list(itemSNInfo.getSn_list());
                positionList.add(positionItem);
            }
        }
        resultItem.setPosition_list(positionList);
        return resultItem;
    }

    //拼采购退货对象
    public static OutStorageReturnConfirmRequestBean getOutStorageReturnConfirmRequestBean(Context context) {
        OutStorageReturnConfirmRequestBean result = new OutStorageReturnConfirmRequestBean();
        OutStorageReturnOverviewBean bean = getOutStorageReturnOverviewBean(context);
        if (!TextUtils.isEmpty(bean.getBody().getOutStorageNumber())) {
            result.setStock_output_id(bean.getBody().getOutStorageNumber());
        }
        result.setRefer_receipt_code(bean.getBody().getRefer_receipt_code());
        result.setPreorder_id(bean.getBody().getPreorder_id());
        result.setOrder_type(bean.getBody().getOrder_type());
        result.setOrder_type_name(bean.getBody().getOrder_type_name());
        result.setReceive_code(bean.getBody().getReceive_code());
        result.setReceive_name(bean.getBody().getReceive_name());
        result.setOrg_code(bean.getBody().getOrg_code());
        result.setGroup_code(bean.getBody().getGroup_code());
        result.setOrg_name(bean.getBody().getOrg_name());
        //物料
        List<OutStorageReturnConfirmRequestBean.ItemListBean> resultItemList = new ArrayList<>();
        List<OutStorageReturnOverviewBean.BodyBean.ItemListBean> itemList = bean.getBody().getItem_list();
        for (int i = 0; i < itemList.size(); i++) {
            OutStorageReturnConfirmRequestBean.ItemListBean resultItem = new OutStorageReturnConfirmRequestBean.ItemListBean();
            OutStorageReturnOverviewBean.BodyBean.ItemListBean item = itemList.get(i);
            resultItem.setStock_output_rid((i + 1) + "");
            resultItem.setRefer_receipt_rid(item.getRefer_receipt_rid());
            resultItem.setMat_id(item.getMat_id());
            resultItem.setUnit_id(item.getUnit_id());
            resultItem.setDecimal_place(item.getDecimal_place());
            resultItem.setFty_id(item.getFty_id());
            resultItem.setLocation_id(item.getLocation_id());
            resultItem.setStock_qty(item.getStock_qty());
            resultItem.setSend_qty(item.getSend_qty());
            resultItem.setOutput_qty(item.getActualSendNumber());//实发数量
            List<OutStorageReturnConfirmRequestBean.ItemListBean.PositionListBean> resultPositionList = new ArrayList<>();
            List<BatchBean.BatchInfoBean> positionList = item.getBatchList();
            for (int j = 0; positionList != null && j < positionList.size(); j++) {
                OutStorageReturnConfirmRequestBean.ItemListBean.PositionListBean resultPositionItem = new OutStorageReturnConfirmRequestBean.ItemListBean.PositionListBean();
                BatchBean.BatchInfoBean positionItem = positionList.get(j);
                resultPositionItem.setStock_output_position_id((j + 1) + "");
                resultPositionItem.setStock_id(positionItem.getStock_id());
                resultPositionItem.setQty(positionItem.getQty());
                resultPositionList.add(resultPositionItem);
            }
            resultItem.setPosition_list(resultPositionList);
            if (!TextUtils.isEmpty(resultItem.getOutput_qty())) {
                resultItemList.add(resultItem);
            }
        }
        result.setItem_list(resultItemList);
        //经办人
        List<OutStorageReturnConfirmRequestBean.UserListBean> resultOperatorList = new ArrayList<>();
        List<GetOperatorBean.OperatorBean> operatorList = bean.getBody().getUser_list();
        for (int i = 0; i < operatorList.size(); i++) {
            OutStorageReturnConfirmRequestBean.UserListBean resultOperatorItem = new OutStorageReturnConfirmRequestBean.UserListBean();
            GetOperatorBean.OperatorBean OperatorItem = operatorList.get(i);
            resultOperatorItem.setUser_id(OperatorItem.getUser_id());
            resultOperatorItem.setRole_id(OperatorItem.getRole_id());
            resultOperatorList.add(resultOperatorItem);
        }
        result.setUser_list(resultOperatorList);
        return result;
    }

    public static void updateProductionOutStorageNumber(Context context, String outStorageNumber) {
        OutStorageProductionOverviewBean bean = getOutStorageProductionOverviewBean(context);
        bean.getBody().setOutStorageNumber(outStorageNumber);
        saveOutStorageProductionOverviewBean(context, bean);
    }

    public static void updatePickingOutStorageNumber(Context context, String outStorageNumber) {
        OutStoragePickingOverviewBean bean = getOutStoragePickingOverviewBean(context);
        bean.getBody().setOutStorageNumber(outStorageNumber);
        saveOutStoragePickingOverviewBean(context, bean);
    }

    public static void updateAllocatingOutStorageNumber(Context context, String outStorageNumber) {
        OutStorageAllocatingOverviewBean bean = getOutStorageAllocatingOverviewBean(context);
        bean.getBody().setOutStorageNumber(outStorageNumber);
        saveOutStorageAllocatingOverviewBean(context, bean);
    }

    public static void updateReturnOutStorageNumber(Context context, String outStorageNumber) {
        OutStorageReturnOverviewBean bean = getOutStorageReturnOverviewBean(context);
        bean.getBody().setOutStorageNumber(outStorageNumber);
        saveOutStorageReturnOverviewBean(context, bean);
    }

    public static void updateSaleOutStorageNumber(Context context, String outStorageNumber) {
        OutStorageSaleOverviewBean bean = getOutStorageSaleOverviewBean(context);
        bean.getBody().setOutStorageNumber(outStorageNumber);
        saveOutStorageSaleOverviewBean(context, bean);
    }

    //获取领料出库行项目概览
    public static List<OverviewAdapter.OverviewBean> getOverViewBeanWithPickingOutStorageList(List<ItemListBean> materielList) {
        List<OverviewAdapter.OverviewBean> resultList = new ArrayList<>();
        for (int i = 0; i < materielList.size(); i++) {
            ItemListBean materielItem = materielList.get(i);
            if (!TextUtils.isEmpty(materielItem.getActualSendNumber())) {
                OverviewAdapter.OverviewBean overItem = new OverviewAdapter.OverviewBean();
                overItem.setInfo(materielItem.getMat_name());
                overItem.setNumber(materielItem.getActualSendNumber() + materielItem.getUnit_name());
                resultList.add(overItem);
            }
        }
        return resultList;
    }

    //获取调拨出库行项目概览
    public static List<OverviewAdapter.OverviewBean> getOverViewBeanWithAllocatingOutStorageList(List<OutStorageAllocatingOverviewBean.BodyBean.ItemListBean> materielList) {
        List<OverviewAdapter.OverviewBean> resultList = new ArrayList<>();
        for (int i = 0; i < materielList.size(); i++) {
            OutStorageAllocatingOverviewBean.BodyBean.ItemListBean materielItem = materielList.get(i);
            if (!TextUtils.isEmpty(materielItem.getActualSendNumber())) {
                OverviewAdapter.OverviewBean overItem = new OverviewAdapter.OverviewBean();
                overItem.setInfo(materielItem.getMat_name());
                overItem.setNumber(materielItem.getActualSendNumber() + materielItem.getUnit_name());
                resultList.add(overItem);
            }
        }
        return resultList;
    }

    //获取销售出库行项目概览
    public static List<OverviewAdapter.OverviewBean> getOverViewBeanWithSaleOutStorageList(List<ItemListBean> materielList) {
        List<OverviewAdapter.OverviewBean> resultList = new ArrayList<>();
        for (int i = 0; i < materielList.size(); i++) {
            ItemListBean materielItem = materielList.get(i);
            if (!TextUtils.isEmpty(materielItem.getActualSendNumber())) {
                OverviewAdapter.OverviewBean overItem = new OverviewAdapter.OverviewBean();
                overItem.setInfo(materielItem.getMat_name());
                overItem.setNumber(materielItem.getActualSendNumber() + materielItem.getUnit_name());
                resultList.add(overItem);
            }
        }
        return resultList;
    }

    //获取采购退货行项目概览
    public static List<OverviewAdapter.OverviewBean> getOverViewBeanWithReturnOutStorageList(List<OutStorageReturnOverviewBean.BodyBean.ItemListBean> materielList) {
        List<OverviewAdapter.OverviewBean> resultList = new ArrayList<>();
        for (int i = 0; i < materielList.size(); i++) {
            OutStorageReturnOverviewBean.BodyBean.ItemListBean materielItem = materielList.get(i);
            if (!TextUtils.isEmpty(materielItem.getActualSendNumber())) {
                OverviewAdapter.OverviewBean overItem = new OverviewAdapter.OverviewBean();
                overItem.setInfo(materielItem.getMat_name());
                overItem.setNumber(materielItem.getActualSendNumber() + materielItem.getUnit_name());
                resultList.add(overItem);
            }
        }
        return resultList;
    }

    //清空原领料出库验收人并添加选择用户组的出库验收人
//    public static void addGroupPickingOverview(Context context, List<GetOperatorBean.OperatorBean> list) {
//        OutStoragePickingOverviewBean bean = getOutStoragePickingOverviewBean(context);
//        bean.getBody().setUser_list(list);
//        Gson gson = new Gson();
//        String json = gson.toJson(bean, OutStoragePickingOverviewBean.class);
//        SPUtils.savePickingOutStorageInformation(context, json);
//    }

    //通过领料出库用户组获取出库验收人列表
    public static List<GetOperatorBean.OperatorBean> getPickingOperatorListByGroupList(Context context, List<GetOperatorGroupBean.OperatorGroupBean> groupListBeanList, String groupCodeStr) {
        List<GetOperatorBean.OperatorBean> list = new ArrayList<>();
        for (int i = 0; i < groupListBeanList.size(); i++) {
            if (groupListBeanList.get(i).getGroup_id().equals(groupCodeStr)) {
                List<GetOperatorBean.OperatorBean> groupList = groupListBeanList.get(i).getGroup_item_list();
                list = groupList;
            }
        }

        return list;
    }

    //清空原调拨出库验收人并添加选择用户组的出库验收人
    public static void addGroupAllocatingOverview(Context context, List<GetOperatorBean.OperatorBean> list) {
        OutStorageAllocatingOverviewBean bean = getOutStorageAllocatingOverviewBean(context);
        bean.getBody().setUser_list(list);
        saveOutStorageAllocatingOverviewBean(context, bean);
    }

    //通过调拨出库用户组获取出库验收人列表
    public static List<GetOperatorBean.OperatorBean> getAllocatingOverviewListByGroupList(Context context, List<GetOperatorGroupBean.OperatorGroupBean> groupListBeanList, String groupCodeStr) {
        List<GetOperatorBean.OperatorBean> list = new ArrayList<>();
        for (int i = 0; i < groupListBeanList.size(); i++) {
            if (groupListBeanList.get(i).getGroup_id().equals(groupCodeStr)) {
                List<GetOperatorBean.OperatorBean> groupList = groupListBeanList.get(i).getGroup_item_list();
                list = groupList;
            }
        }

        return list;
    }

//    //清空原销售出库验收人并添加选择用户组的出库验收人
//    public static void addGroupOutStorageSale(Context context, List<GetOperatorBean.OperatorBean> list) {
//        OutStorageSaleOverviewBean bean = getOutStorageSaleOverviewBean(context);
//        bean.getBody().setUser_list(list);
//        saveOutStorageSaleOverviewBean(context, bean);
//    }

    //通过销售出库用户组获取出库验收人列表
    public static List<GetOperatorBean.OperatorBean> getSaleOperatorListByGroupList(Context context, List<GetOperatorGroupBean.OperatorGroupBean> groupListBeanList, String groupCodeStr) {
        List<GetOperatorBean.OperatorBean> list = new ArrayList<>();
        for (int i = 0; i < groupListBeanList.size(); i++) {
            if (groupListBeanList.get(i).getGroup_id().equals(groupCodeStr)) {
                List<GetOperatorBean.OperatorBean> groupList = groupListBeanList.get(i).getGroup_item_list();
                list = groupList;
            }
        }

        return list;
    }

    //清空原退货出库验收人并添加选择用户组的出库验收人
    public static void addGroupOutStorageReturn(Context context, List<GetOperatorBean.OperatorBean> list) {
        OutStorageReturnOverviewBean bean = getOutStorageReturnOverviewBean(context);
        bean.getBody().setUser_list(list);
        saveOutStorageReturnOverviewBean(context, bean);
    }

    //通过退货出库用户组获取出库验收人列表
    public static List<GetOperatorBean.OperatorBean> getOutStorageReturnListByGroupList(Context context, List<GetOperatorGroupBean.OperatorGroupBean> groupListBeanList, String groupCodeStr) {
        List<GetOperatorBean.OperatorBean> list = new ArrayList<>();
        for (int i = 0; i < groupListBeanList.size(); i++) {
            if (groupListBeanList.get(i).getGroup_id().equals(groupCodeStr)) {
                List<GetOperatorBean.OperatorBean> groupList = groupListBeanList.get(i).getGroup_item_list();
                list = groupList;
            }
        }

        return list;
    }

    //获取其他出库信息
    public static OutStorageOtherBean getOutStorageOtherBean(Context context) {
        String json = SPUtils.getOtherOutStorageInformation(context);
        if (TextUtils.isEmpty(json)) {
            return new OutStorageOtherBean();
        } else {
            Gson gson = new Gson();
            return gson.fromJson(json, OutStorageOtherBean.class);
        }
    }

    //检查其它出库列表是否至少填写一项
    public static int getOtherOutStorageNumber(Context context) {
        int result = 0;
        List<OutStorageOtherOverviewBean.BodyBean> materielList = getOutStorageOtherBean(context).getMaterielList();
        if (materielList == null) {
            Utils.middleToast(context, context.getResources().getString(R.string.activity_in_storage_free_overview_at_least_one_item));
        } else {
            for (int i = 0; i < materielList.size(); i++) {
                OutStorageOtherOverviewBean.BodyBean materielItem = materielList.get(i);
                if (!TextUtils.isEmpty(materielItem.getActualSendNumber()) && Float.parseFloat(materielItem.getActualSendNumber()) > 0) {
                    result = result + 1;
                }
            }
        }

        return result;
    }

    //删除其他出库物料信息
    public static void deleteOtherMateriel(Context context, String materielCode) {
        OutStorageOtherBean bean = getOutStorageOtherBean(context);
        List<OutStorageOtherOverviewBean.BodyBean> list = bean.getMaterielList();
        for (int i = 0; i < list.size(); i++) {
            OutStorageOtherOverviewBean.BodyBean materielItem = list.get(i);
            if (materielItem.getMat_code().equals(materielCode)) {
                list.remove(materielItem);
                break;
            }
        }
        bean.setMaterielList(list);
        Gson gson = new Gson();
        String json = gson.toJson(bean, OutStorageOtherBean.class);
        SPUtils.saveOtherOutStorageInformation(context, json);
    }

    //保存其他出库信息
    public static void saveOutStorageOtherBean(Context context, OutStorageOtherBean bean) {
        Gson gson = new Gson();
        SPUtils.saveOtherOutStorageInformation(context, gson.toJson(bean, OutStorageOtherBean.class));
    }

    //通过物料编码获取其它出库详情
    public static OutStorageOtherOverviewBean.BodyBean geOtherOutStorageDetailBySerial(Context context, String serial) {
        List<OutStorageOtherOverviewBean.BodyBean> MaterielList = getOutStorageOtherBean(context).getMaterielList();
        for (int i = 0; i < MaterielList.size(); i++) {
            OutStorageOtherOverviewBean.BodyBean bean = MaterielList.get(i);
            if (bean.getMat_code().equals(serial)) {
                return bean;
            }
        }
        return null;
    }

    //更新其它库详情
    public static void updateOtherOutStorageDetail(Context context, OutStorageOtherOverviewBean.BodyBean materielItem) {
        OutStorageOtherBean bean = getOutStorageOtherBean(context);
        List<OutStorageOtherOverviewBean.BodyBean> saleOutStorageList = bean.getMaterielList();
        for (int i = 0; i < saleOutStorageList.size(); i++) {
            OutStorageOtherOverviewBean.BodyBean saleOutStorageItem = saleOutStorageList.get(i);
            if (materielItem.getMat_code().equals(saleOutStorageItem.getMat_code())) {
                saleOutStorageList.remove(saleOutStorageItem);
                break;
            }
        }
        saleOutStorageList.add(0, materielItem);
        bean.setMaterielList(saleOutStorageList);
        Gson gson = new Gson();
        String json = gson.toJson(bean, OutStorageOtherBean.class);
        SPUtils.saveOtherOutStorageInformation(context, json);
    }

    //删除其他出库验收人
    public static void deleteOtherOperator(Context context, String id) {
        OutStorageOtherBean bean = getOutStorageOtherBean(context);
        List<GetOperatorBean.OperatorBean> operatorList = bean.getOperatorList();
        for (int i = 0; i < operatorList.size(); i++) {
            GetOperatorBean.OperatorBean operatorItem = operatorList.get(i);
            if (operatorItem.getUser_id().equals(id)) {
                operatorList.remove(operatorItem);
                break;
            }
        }
        bean.setOperatorList(operatorList);
        Gson gson = new Gson();
        String json = gson.toJson(bean, OutStorageOtherBean.class);
        SPUtils.saveOtherOutStorageInformation(context, json);
    }

    //清空原其它出库验收人并添加选择用户组的出库验收人
    public static void addGroupOtherAddOperator(Context context, List<GetOperatorBean.OperatorBean> list) {
        OutStorageOtherBean bean = getOutStorageOtherBean(context);
        bean.setOperatorList(list);
        saveOutStorageOtherBean(context, bean);
    }

    //通过其它出库用户组获取出库验收人列表
    public static List<GetOperatorBean.OperatorBean> getOtherAddOperatorListByGroupList(Context context, List<GetOperatorGroupBean.OperatorGroupBean> groupListBeanList, String groupCodeStr) {
        List<GetOperatorBean.OperatorBean> list = new ArrayList<>();
        for (int i = 0; i < groupListBeanList.size(); i++) {
            if (groupListBeanList.get(i).getGroup_id().equals(groupCodeStr)) {
                List<GetOperatorBean.OperatorBean> groupList = groupListBeanList.get(i).getGroup_item_list();
                list = groupList;
            }
        }

        return list;
    }

    //是否有其他出库操作人员
    public static boolean hasOtherOperator(Context context) {
        List<GetOperatorBean.OperatorBean> operatorList = getOutStorageOtherBean(context).getOperatorList();
        if (operatorList != null && !operatorList.isEmpty()) {
            return true;
        }
        return false;
    }

    //添加其他出库验收人
    public static void addOtherOperator(Context context, GetOperatorBean.OperatorBean receiveItem) {
        OutStorageOtherBean bean = getOutStorageOtherBean(context);
        List<GetOperatorBean.OperatorBean> receiverList = bean.getOperatorList();
        if (receiverList == null) {
            receiverList = new ArrayList<>();
        }
        receiverList.add(0, receiveItem);
        bean.setOperatorList(receiverList);
        Gson gson = new Gson();
        String json = gson.toJson(bean, OutStorageOtherBean.class);
        SPUtils.saveOtherOutStorageInformation(context, json);
    }

    public static int getOtherOutStorageConfirmNumber(Context context) {
//        int result = 0;
//        List<OutStorageOtherOverviewBean.DataBean.MaterielListBean> list = getOutStorageOtherBean(context).getMaterielList();
//        if (list == null) {
//            return result;
//        } else {
//            for (int i = 0; i < list.size(); i++) {
//                OutStorageOtherOverviewBean.DataBean.MaterielListBean otherInStorageItem = list.get(i);
//                //验证批次特性
//                boolean batchFlag = true;
//                List<InStorageOtherOverviewBean.DataBean.MaterielListBean.BatchBean> batchList = otherInStorageItem.getBatch();
//                for (int j = 0; j < batchList.size(); j++) {
//                    InStorageOtherOverviewBean.DataBean.MaterielListBean.BatchBean batchBean = batchList.get(j);
//                    if (REQUIRED_TRUE.equals(batchBean.getRequired())) {
//                        if (TextUtils.isEmpty(batchBean.getText()) && TextUtils.isEmpty(batchBean.getValue())) {
//                            batchFlag = false;
//                            break;
//                        }
//                    }
//                }
//                if (!TextUtils.isEmpty(otherInStorageItem.getInStorageNumber()) && batchFlag) {
//                    result = result + 1;
//                }
//            }
//        }
//        return result;
        int result = 0;
        List<OutStorageOtherOverviewBean.BodyBean> materielList = getOutStorageOtherBean(context).getMaterielList();
        for (int i = 0; i < materielList.size(); i++) {
            OutStorageOtherOverviewBean.BodyBean materielItem = materielList.get(i);
            if (!TextUtils.isEmpty(materielItem.getActualSendNumber()) && Float.parseFloat(materielItem.getActualSendNumber()) > 0) {
                result = result + 1;
            }
        }
        return result;
    }

    //获取其他出库行项目概览
    public static List<OverviewAdapter.OverviewBean> getOverViewBeanWithOtherOutSorageList(List<OutStorageOtherOverviewBean.BodyBean> materielList) {
        List<OverviewAdapter.OverviewBean> resultList = new ArrayList<>();
        for (int i = 0; i < materielList.size(); i++) {
            OutStorageOtherOverviewBean.BodyBean materielItem = materielList.get(i);
            if (!TextUtils.isEmpty(materielItem.getActualSendNumber())) {
                OverviewAdapter.OverviewBean overItem = new OverviewAdapter.OverviewBean();
                overItem.setInfo(materielItem.getMat_name());
                overItem.setNumber(materielItem.getActualSendNumber() + materielItem.getUnit_name());
                resultList.add(overItem);
            }
        }
        return resultList;
    }

    //拼其它出库对象
    public static OutStorageOtherConfirmRequestBean getOutStorageOtherConfirmRequestBean(Context context) {
        OutStorageOtherConfirmRequestBean result = new OutStorageOtherConfirmRequestBean();
        OutStorageOtherBean bean = getOutStorageOtherBean(context);
        if (!TextUtils.isEmpty(bean.getOutStorageNumber())) {
            result.setStock_output_id(bean.getOutStorageNumber());
        }
        result.setReceive_code(bean.getReceivingPartyCode());
        result.setReceive_name(bean.getReceivingPartyValue());
        //物料
        List<OutStorageOtherConfirmRequestBean.ItemListBean> resultItemList = new ArrayList<>();
        List<OutStorageOtherOverviewBean.BodyBean> itemList = bean.getMaterielList();
        for (int i = 0; i < itemList.size(); i++) {
            OutStorageOtherConfirmRequestBean.ItemListBean resultItem = new OutStorageOtherConfirmRequestBean.ItemListBean();
            OutStorageOtherOverviewBean.BodyBean item = itemList.get(i);
            resultItem.setStock_output_rid((i + 1) + "");
            resultItem.setMat_id(item.getMat_id());
            resultItem.setUnit_id(item.getUnit_id());
            resultItem.setMove_type_id(bean.getMoveTypeValue());
            resultItem.setRefer_price("0");//参考价格客户端并没有值，写的0是固定死的，联系高海涛确认
            resultItem.setDecimal_place(item.getDecimal_place());
            resultItem.setFty_id(item.getFty_id());
            resultItem.setLocation_id(item.getLocation_id());
            resultItem.setStock_qty(item.getQty());
            resultItem.setSend_qty("0");//已出库数量客户端并没有值，写的0是固定死的，联系高海涛确认
            resultItem.setOutput_qty(item.getActualSendNumber());//实发数量
            List<OutStorageOtherConfirmRequestBean.ItemListBean.PositionListBean> resultPositionList = new ArrayList<>();
            List<BatchBean.BatchInfoBean> positionList = item.getBatchList();
            for (int j = 0; positionList != null && j < positionList.size(); j++) {
                OutStorageOtherConfirmRequestBean.ItemListBean.PositionListBean resultPositionItem = new OutStorageOtherConfirmRequestBean.ItemListBean.PositionListBean();
                BatchBean.BatchInfoBean positionItem = positionList.get(j);
                resultPositionItem.setStock_output_position_id((j + 1) + "");
                resultPositionItem.setStock_id(positionItem.getStock_id());
                resultPositionItem.setQty(positionItem.getQty());
                resultPositionList.add(resultPositionItem);
            }
            resultItem.setPosition_list(resultPositionList);
            if (!TextUtils.isEmpty(resultItem.getOutput_qty())) {
                resultItemList.add(resultItem);
            }
        }
        result.setItem_list(resultItemList);
        //经办人
        List<OutStorageOtherConfirmRequestBean.UserListBean> resultOperatorList = new ArrayList<>();
        List<GetOperatorBean.OperatorBean> operatorList = bean.getOperatorList();
        for (int i = 0; i < operatorList.size(); i++) {
            OutStorageOtherConfirmRequestBean.UserListBean resultOperatorItem = new OutStorageOtherConfirmRequestBean.UserListBean();
            GetOperatorBean.OperatorBean OperatorItem = operatorList.get(i);
            resultOperatorItem.setUser_id(OperatorItem.getUser_id());
            resultOperatorItem.setRole_id(OperatorItem.getRole_id());
            resultOperatorList.add(resultOperatorItem);
        }
        result.setUser_list(resultOperatorList);
        return result;
    }

    public static void updateOtherOutStorageNumber(Context context, String outStorageNumber) {
        OutStorageOtherBean bean = getOutStorageOtherBean(context);
        bean.setOutStorageNumber(outStorageNumber);
        saveOutStorageOtherBean(context, bean);
    }

    public static void createEditText(Context context, ViewGroup viewGroup, String name, String unit, int id) {
        LayoutInflater inflater = LayoutInflater.from(context);
        View view = inflater.inflate(R.layout.view_out_storage_caiculator, null);
        view.setId(id);
        TextView nameTextView = (TextView) view.findViewById(R.id.name);
        TextView unitTextView = (TextView) view.findViewById(R.id.unit);
        EditText textEditText = (EditText) view.findViewById(R.id.text);
        textEditText.addTextChangedListener(new TextWatcher() {
            @Override
            public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
            }

            @Override
            public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
            }

            @Override
            public void afterTextChanged(Editable editable) {
                String temp = editable.toString();
                int posDot = temp.indexOf(".");
                if (posDot <= 0) return;
                if (temp.length() - posDot - 1 > 2) {
                    editable.delete(posDot + 3, posDot + 4);
                }
            }
        });
        nameTextView.setText(name);
        unitTextView.setText(unit);
        viewGroup.addView(view);
    }

    public static String check(Context context, List<OutStorageCalculatorBean.DataBean.CalculatorBean.PropertyListBean> list, View view) {
        for (int i = 0; i < list.size(); i++) {
            View view1 = view.findViewById(i + 1);
            EditText textEditText = (EditText) view1.findViewById(R.id.text);
            if (TextUtils.isEmpty(textEditText.getText().toString())) {
                return list.get(i).getName() + context.getResources().getString(R.string.activity_in_storage_receive_materiel_detail_required_not_null);
            }
        }
        return null;
    }

    public static String calculate(String constantValue, List<OutStorageCalculatorBean.DataBean.CalculatorBean.PropertyListBean> list, View view) {
        String calculateResult;
        double[] result = new double[list.size() + 1];
        for (int i = 0; i < list.size(); i++) {
            View view1 = view.findViewById(i + 1);
            EditText textEditText = (EditText) view1.findViewById(R.id.text);
            result[i] = Double.parseDouble(textEditText.getText().toString());
        }
        result[list.size()] = Double.parseDouble(constantValue);
        calculateResult = String.valueOf(ArithUtils.mul(result));
        return calculateResult;
    }

    public static List<GetOperatorBean.OperatorBean> filterReceiver(List<GetOperatorBean.OperatorBean> allReceiverList, List<GetOperatorBean.OperatorBean> currentReceiverList) {
        if (currentReceiverList == null) {
            return allReceiverList;
        }
        List<GetOperatorBean.OperatorBean> removeReceiverList = new ArrayList<>();
        for (int i = 0; i < allReceiverList.size(); i++) {
            GetOperatorBean.OperatorBean receiverItem = allReceiverList.get(i);
            for (int j = 0; j < currentReceiverList.size(); j++) {
                if (receiverItem.getUser_id().equals(currentReceiverList.get(j).getUser_id())) {
                    removeReceiverList.add(receiverItem);
                }
            }
        }
        allReceiverList.removeAll(removeReceiverList);
        return allReceiverList;
    }

    public static List<BatchBean.BatchInfoBean> filterBatch(List<BatchBean.BatchInfoBean> allData, List<BatchBean.BatchInfoBean> returnData) {
        List<BatchBean.BatchInfoBean> repeatList = new ArrayList<>();
        for (int i = 0; i < returnData.size(); i++) {
            BatchBean.BatchInfoBean returnItem = returnData.get(i);
            for (int j = 0; j < allData.size(); j++) {
                BatchBean.BatchInfoBean allItem = allData.get(j);
//                if (allItem.getPosition_code().equals(returnItem.getPosition_code()) && allItem.getBatch().equals(returnItem.getBatch())) {
                if (allItem.getStock_id().equals(returnItem.getStock_id())) {
                    repeatList.add(returnItem);
                }
            }
        }
        returnData.removeAll(repeatList);
        return returnData;
    }

    public static boolean checkInventory(String inventoryNumber, String number) {
        double inventoryNumberDou = Double.parseDouble(inventoryNumber);
        double numberDou = Double.parseDouble(number);
        if (inventoryNumberDou >= numberDou) {
            return true;
        } else {
            return false;
        }
    }

    public static int checkPosition(List<BatchBean.BatchInfoBean> batchList, String position) {
        int result = -1;
        for (int i = 0; i < batchList.size(); i++) {
            BatchBean.BatchInfoBean batchItem = batchList.get(i);
            if (batchItem.getPosition_code().equals(position)) {
                batchItem.setIsConfirm(CONFIRM);
                result = i + 1;
            }
        }
        return result;
    }

    //检查实际发出数量是否大于可发数量
    public static String checkCanSendNumber(Context context, String actualSendNumber, String canSendNumber) {
        if (!TextUtils.isEmpty(actualSendNumber) && !TextUtils.isEmpty(canSendNumber)) {
            BigDecimal actualSendNumberBigDecimal = new BigDecimal(actualSendNumber);
            BigDecimal canSendNumberBigDecimal = new BigDecimal(canSendNumber);
            if (actualSendNumberBigDecimal.compareTo(canSendNumberBigDecimal) == 1) {
                return context.getResources().getString(R.string.activity_out_storage_sale_detail_forced_to_quit);
            }
        }
        return null;
    }

    public static String checkConfirm(Context context, List<BatchBean.BatchInfoBean> batchList) {
        for (int i = 0; i < batchList.size(); i++) {
            BatchBean.BatchInfoBean batchItem = batchList.get(i);
            if (!CONFIRM.equals(batchItem.getIsConfirm())) {
                return context.getResources().getString(R.string.activity_in_storage_allocating_overview_control) + (i + 1) + context.getResources().getString(R.string.activity_out_storage_sale_detail_have_not_been_confirmed);
            }
        }
        return null;
    }

    //检查数量是否为空，并且不为零
    public static String checkNumber(Context context, List<BatchBean.BatchInfoBean> batchList) {
        for (int i = 0; i < batchList.size(); i++) {
            BatchBean.BatchInfoBean batchItem = batchList.get(i);
            if (!TextUtils.isEmpty(batchItem.getQty()) && RegexUtils.checkZero(batchItem.getQty())) {
                return context.getResources().getString(R.string.activity_in_storage_allocating_overview_control) + (i + 1) + context.getResources().getString(R.string.activity_out_storage_sale_detail_not_illegal);
            }
        }
        return null;
    }

    //检查保留小数位
    public static String checkRetainDecimal(Context context, List<BatchBean.BatchInfoBean> batchList, String retainDecimal) {
        for (int i = 0; i < batchList.size(); i++) {
            BatchBean.BatchInfoBean batchItem = batchList.get(i);
            if (!TextUtils.isEmpty(batchItem.getQty()) && !Utils.checkRetainDecimal(batchItem.getQty(), retainDecimal)) {
                return context.getResources().getString(R.string.activity_in_storage_receive_overview_serial) + (i + 1) + String.format(context.getResources().getString(R.string.common_retain_decimal_illegal), TextUtils.isEmpty(retainDecimal) ? context.getResources().getString(R.string.common_retain_decimal_unlimited) : retainDecimal);
            }
        }
        return null;
    }

    public static boolean filterSN(List<SNBean.SNInfoBean> allData, SNBean.SNInfoBean snData) {
        if (allData == null || allData.isEmpty()) {
            return false;
        }
        for (int i = 0; i < allData.size(); i++) {
            SNBean.SNInfoBean item = allData.get(i);
            if (item.getPackage_id().equals(snData.getPackage_id())) {
                //打包码相同，表示存在
                return true;
            } else {
                if (item.getSn_list().size() == 1 && snData.getSn_list().size() == 1) {
                    //size都等于1标识都是序列号
                    if (item.getSn_list().get(0).getSn_id().equals(snData.getSn_list().get(0).getSn_id())) {
                        //两个序列号相同，表示存在
                        return true;
                    } else {
                        //两个序列号不相同，表示不存在，继续循环
                        continue;
                    }
                } else {
                    //打包码不相同，并且又不是序列号，表示不存在
                    continue;
                }
            }
        }
        return false;
    }

    public static List<SNItemInfo> changeSNFormat(List<SNBean.SNInfoBean> snList) {
        List<SNItemInfo> result = new ArrayList<>();
        if (snList == null || snList.isEmpty()) {
            return result;
        }
        for (int i = 0; i < snList.size(); i++) {
            SNBean.SNInfoBean snInfoBean = snList.get(i);
            if (!isExistSNItem(result, SNTYPE_POSITION, snInfoBean.getPosition_code())) {
                result.add(new SNItemInfo(SNTYPE_POSITION, snInfoBean.getPosition_code()));
            }
            switch (snInfoBean.getType()) {
                case SNTYPE_PACKAGE:
                    if (!isExistSNItem(result, SNTYPE_PACKAGE, snInfoBean.getPackage_code())) {
                        result.add(new SNItemInfo(SNTYPE_PACKAGE, snInfoBean.getPackage_code()));
                    }
                    break;
                case SNTYPE_SN:
                    if (!isExistSNItem(result, SNTYPE_SN, snInfoBean.getSn_list().get(0).getSn_code())) {
                        result.add(new SNItemInfo(SNTYPE_SN, snInfoBean.getSn_list().get(0).getSn_code()));
                    }
                    break;
            }
        }
        return result;
    }

    private static boolean isExistSNItem(List<SNItemInfo> list, String type, String code) {
        boolean result = false;
        if (list == null || list.isEmpty()) {
            return false;
        }
        for (int i = 0; i < list.size(); i++) {
            SNItemInfo snItemInfo = list.get(i);
            if (snItemInfo.getType().equals(type) && snItemInfo.getCode().equals(code)) {
                return true;
            }
        }
        return result;
    }

    public static List<SNItemInfo> getPackageDetail(List<SNBean.SNInfoBean> snItemList, String packageCode) {
        List<SNItemInfo> result = new ArrayList<>();
        for (int i = 0; i < snItemList.size(); i++) {
            SNBean.SNInfoBean snInfoItem = snItemList.get(i);
            if (snInfoItem.getType().equals(OutStorageUtils.SNTYPE_PACKAGE) && snInfoItem.getPackage_code().equals(packageCode)) {
                List<SNBean.SNInfoBean.SnListBean> snList = snInfoItem.getSn_list();
                for (int j = 0; j < snList.size(); j++) {
                    result.add(new SNItemInfo(SNTYPE_SN, snList.get(j).getSn_code()));
                }
                break;
            }
        }
        return result;
    }

    public static List<BatchBean.BatchInfoBean> removeNoNumberItem(List<BatchBean.BatchInfoBean> batchList) {
        List<BatchBean.BatchInfoBean> removeList = new ArrayList<>();
        for (int i = 0; i < batchList.size(); i++) {
            BatchBean.BatchInfoBean batchItem = batchList.get(i);
            if (TextUtils.isEmpty(batchItem.getQty())) {
                removeList.add(batchItem);
            }
        }
        batchList.removeAll(removeList);
        return batchList;

    }

}
